using System;
using System.Data;
using System.Web; 
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// Summary description for DropDownList
/// </summary>
public partial class ControlHelper
{
    public void FillDataTableToDropDownList(DropDownList dropDownList, string displayMember, string valueMember)
    {
        SqlServerDataProvider sqlServerDataProvider = 
        new SqlServerDataProvider(connectionString);
        DataTable dataTable = 
        sqlServerDataProvider.GetDataTable(
        commandText, commandType);
        if (dataTable != null)
        {
            dropDownList.DataSource = dataTable;
            dropDownList.DataTextField=displayMember;
            dropDownList.DataValueField=valueMember;  
        }
        else
            dropDownList.DataSource = null;            
        dropDownList.DataBind();
    }
    
}
